﻿Imports extranet.BE
Imports extranet.DA

Public Class BCTela

  Public Shared Sub Cadastrar(ByVal objBETela As BETela)
    Dim objDATela As New DATela
    objDATela.Cadastra(objBETela)
  End Sub

  Public Shared Sub Atualizar(ByVal objBETela As BETela)
    Dim objDATela As New DATela
    objDATela.Atualiza(objBETela)
  End Sub

  Public Shared Sub Excluir(ByVal objBETela As BETela)
    Dim objDATela As New DATela
    objDATela.Exclui(objBETela)
  End Sub

  Public Shared Function Selecionar(ByVal intIdTela As Integer) As List(Of BETela)
    Dim objDATela As New DATela()
    Return objDATela.Seleciona(New BETela(intIdTela))
  End Function

  Public Shared Function Selecionar(ByVal strDescricao As String, ByVal strModulo As String, ByVal sortExpression As String, ByVal sortDirection As String) As List(Of BETela)
    Dim objDATela As New DATela
    objDATela.objQuery.Sort = New BESort(sortExpression, sortDirection)
    Return objDATela.Seleciona(New BETela(Nothing, Nothing, strDescricao, strModulo))
  End Function

  Public Shared Function SelecionaPeloGrupoAcesso(ByVal intIdGrupoAcesso As Integer) As List(Of BETela)
    Dim objDATela As New DATela
    Dim objBETelas As List(Of BETela) = objDATela.SelecionaPeloGrupoAcesso(intIdGrupoAcesso)
    For Each objBETela As BETela In objBETelas
      objDATela.SelecionaPermissoes(objBETela, intIdGrupoAcesso)
    Next
    Return objBETelas
  End Function

End Class
